<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head th:replace="_fragment_front :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>资源库</title>
    <link rel="stylesheet" href="../static/css/me.css">
    <link rel="stylesheet" href="../static/lib/semantic/semantic.min.css">
</head>
<body class="body resourceBody">

    <!--导航-->
    <nav th:replace="_fragment_front :: nav(4)" class="gird-header">
        <div class="ui container">
            <div class="ui inverted secondary stackable menu">
                <a href="#"><h2 class="ui olive header item">风铃</h2></a>
                <a href="#" class="m-item item m-mobile-hide"><i class="home icon"></i>首页</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="idea icon"></i>分类</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="pencil alternate icon"></i>友链</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="graduation cap icon"></i>资源库</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="clone icon"></i>归档</a>
                <div class="m-item item right m-mobile-hide">
                    <form action="#" name="search" target="_blank">
                        <div class="ui icon inverted transparent input m-margin-tb-tiny">
                            <input type="text" name="query" placeholder="Search....">
                            <i class="search link icon"></i>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
            <i class="sidebar icon"></i>
        </a>
    </nav>

    <!--顶部图片-->
    <div class="m-bg-type_outer m-top">
        <img th:src="@{/images/resourcebg.jpg}" alt="分类背景图" class="ui m-bg image m-top-image">
        <div class="m-bg-class_cover">
            <div class="ui container m-top-image-text">
                <div class="m-font-size-title m-right-bottom m-center">资源库</div>
                <div class="m-font-size-text-init-title m-margin-top m-center" th:text="#{resource-sentence}"></div>
            </div>
        </div>
    </div>

    <!--中间内容-->
    <div id="waypoint" class="m-margin-tiny- animated fadeIn">
        <div class="ui m-opacity container">

            <div class="ui segment m-opacity">
                <div class="ui container m-center">
                    <div class="ui labeled button m-margin-tb-tiny" th:each="resourceType : ${resourceTypes}">
                        <a href="#studyresource" class="ui basic teal button" th:text="${resourceType.name}">学习资源</a>
                        <div class="ui basic teal left pointing label" th:text="${resourceType.parentHasResources}">57</div>
                    </div>
                </div>
            </div>

            <!--资源区域-->
            <div class="box-shadow-max">
                <div class="ui top attached teal m-opacity segment box-shadow-max">
                    <div class="ui m-padded-tb-large">
                        <div class="ui stackable m-opacity grid">

                            <th:block th:each="resource : ${resources}">
                            <h2 id="studyresource" style="margin: 0 auto" class="ui header">
                                <div class="content">
                                    <span th:text="${resource.key}">学习资源</span>
                                </div>
                            </h2>

                            <div class="ui stackable four cards m-margin-top grid" style="width: 6000px">
                                <a th:href="${res.link}" target="_blank" class="orange card" th:each="res : ${resource.value}">
                                    <div class="content">
                                        <img class="left circular floated mini ui image resourceImg" th:src="${res.cover}">
                                        <div class="left resourceName" th:text="${res.name}">B站</div>
                                        <div class="meta" th:text="${res.twoTypeName}">视屏类</div>
                                        <div class="description" th:text="${res.description}">众所周知，B站是一个学习网站</div>
                                    </div>
                                </a>
                            </div>
                            <th:block>

                        </div>

                    </div>
                </div>
            </div>

        </div>
    </div>

    <!--置顶图标-->
    <div id="toolbar" class="m-padded-tb-large m-fixed m-right-bottom" style="display: none">
        <a href="#" class="ui teal icon button"><i class="chevron up icon"></i></a>
    </div>

    <br>
    <br>

    <!--底部栏-->
    <footer th:replace="_fragment_front :: footer" class="ui inverted vertical segment m-padded-tb-massive m-opacity">
        <!--容器-->
        <div class="ui center aligned container">
            <div class="ui inverted divided stackable grid">
                <div class="four wide column">
                    <div class="ui inverted m-text-thin m-text-spaced m-margin-top-max m-footer-title">联系我</div>
                    <div class="ui inverted link list">
                        <div class="m-text-thin">Email：2540487435@qq.com</div>
                        <div class="m-text-thin">QQ：2540487435</div>
                    </div>
                </div>

                <div class="four wide column" >
                    <div class="ui inverted link list">
                        <div class="item">
                            <!--微信二维码-->
                            <div class="ui inverted m-text-thin m-text-spaced m-footer-title">添加微信</div>
                            <img src="../static/images/wechat.png" class="ui m-margin-top rounded image m-QR" alt="">
                        </div>
                    </div>
                </div>

                <div class="four wide column">
                    <div class="ui inverted link list">
                        <div class="item">
                            <!--qq群二维码-->
                            <div class="ui inverted m-text-thin m-text-spaced m-footer-title">添加QQ</div>
                            <img src="../static/images/QQ.jpeg" class="ui m-margin-top rounded image m-QR" alt="">
                        </div>
                    </div>
                </div>
                <!--博客运行时间统计-->
                <div class="four wide column">
                    <div style="font-size: large;font-weight: bold" class="ui inverted m-text-thin m-text-spaced m-margin-top">博客总览</div>
                    <div id="blog-message">
                        <div class="ui inverted link list m-padded-tiny m-margin-top">
                            <div class="m-text-thin m-footer-position">
                                文章总数： <h4 class="ui orange header m-inline-block m-margin-top-null"> 1314 </h4> 篇
                            </div>
                            <div class="m-text-thin m-footer-position">
                                访问总数： <h4 class="ui orange header m-inline-block m-margin-top-null"> 1314 </h4> 次
                            </div>
                            <div class="m-text-thin m-footer-position">
                                评论总数： <h4 class="ui orange header m-inline-block m-margin-top-null"> 1314 </h4> 条
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="ui inverted section divider"></div>
            <div class="ui inverted m-text-thin m-text-spaced m-footer-time">此网站已运行：<span id="timer" class="item m-text-thin"></span></div>
        </div>
    </footer>

    <!--/*/<th:block th:replace="_fragment_front :: script">/*/-->
    <script src="../static/layuimini/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <script src="../static/lib/semantic/semantic.min.js"></script>
    <script src="../static/lib/waypoints/jquery.waypoints.min.js"></script>
    <!--人物的看板娘-->
    <script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>

    <script>
        /*此处为网站的创建时间*/
        function setTime() {
            var create_time = Math.round(new Date(Date.UTC(2021, 6, 23, 0, 0, 0)).getTime() / 1000);
            var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
            currentTime = secondToDate((timestamp - create_time));
            $('#timer').html(currentTime[0] + '年' + currentTime[1] + '天' + currentTime[2] + '时' + currentTime[3] + '分' + currentTime[4] + '秒')
        }
        setInterval(setTime, 1000)
        //计算时间
        function secondToDate(second) {
            if (!second) {
                return 0
            }
            var time = new Array(0, 0, 0, 0, 0)
            if (second >= 365 * 24 * 3600) {
                time[0] = parseInt(second / (365 * 24 * 3600))
                second %= 365 * 24 * 3600
            }
            if (second >= 24 * 3600) {
                time[1] = parseInt(second / (24 * 3600))
                second %= 24 * 3600
            }
            if (second >= 3600) {
                time[2] = parseInt(second / 3600)
                second %= 3600
            }
            if (second >= 60) {
                time[3] = parseInt(second / 60)
                second %= 60
            }
            if (second > 0) {
                time[4] = second
            }
            return time;
        }

        //看板娘初始化
        L2Dwidget.init({
            "model": {
                jsonPath: "https://unpkg.com/live2d-widget-model-miku@1.0.5/assets/miku.model.json",
                "scale": 1
            },
            "display": {
                "position": "left",
                "width": 120,
                "height": 170,
                "hOffset": 0,
                "vOffset": 0
            },
            "mobile": {
                "show": true,
                "scale": 0.5
            },
            "react": {
                "opacityDefault": 0.7,
                "opacityOnHover": 0.8
            },
        })

        //回到顶部按钮
        var waypoint = new Waypoint({
            element: $('#waypoint'),
            handler: function(direction) {
                if (direction == 'down') {
                    $('#toolbar').show(100)
                } else {
                    $('#toolbar').hide(500)
                }
            }
        })

        //手机汉堡菜单
        $('.menu.toggle').click(function () {
            $('.m-item').toggleClass('m-mobile-hide');
        })

    </script>
    <!--/*/</th:block>/*/-->
</body>
</html>
